<?php
include("include/config.inc.php");
if(!isset($_SESSION['s_activId']))
{
  $_SESSION['s_urlRedirectDir'] = $_SERVER['REQUEST_URI'];
  header("Location:checkLogin.php");
}
else
{
	$k=0;
	$loanListArray = array();
  $selectLoan = "SELECT loanId,loanDate,amount,interst,givenAmount,partyName,phoneNumber
                   FROM loan
                 LEFT JOIN party ON party.partyId = loan.partyId";
  $selectLoanRes = mysql_query($selectLoan);
  while($loanRow = mysql_fetch_array($selectLoanRes))
  {
  	$loanListArray[$k]['loanId']      = $loanRow['loanId'];
  	$loanListArray[$k]['partyName']   = $loanRow['partyName'];
  	$loanListArray[$k]['phoneNumber'] = $loanRow['phoneNumber'];
  	$loanListArray[$k]['loanDate']    = $loanRow['loanDate'];
  	$loanListArray[$k]['amount']      = $loanRow['amount'];
  	$loanListArray[$k]['interst']     = $loanRow['interst'];
  	$loanListArray[$k]['givenAmount'] = $loanRow['givenAmount'];
  	$k++;                        
  }
  include("./bottom.php");
  $smarty->assign("loanListArray",$loanListArray);
  $smarty->display("loanList.tpl");
}  
?>